package com.example.wc.logindemo.blogdb;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.example.wc.logindemo.blogdb.BlogDbSchema.BlogTable;


/**
 * Created by hui on 2017/3/8.
 */

public class BlogBaseHelper extends SQLiteOpenHelper {
    private static final int VERSION = 1;
    private static final String DATABASE_NAME = "blogBase_db";

    public BlogBaseHelper(Context context) {
        super(context, DATABASE_NAME, null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table " + BlogTable.NAME + "(" +
                " _id integer primary key autoincrement, " +
                BlogTable.Cols.ID + ", " +
                BlogTable.Cols.NAME + ", " +
                BlogTable.Cols.CONTENT +", " +
                BlogTable.Cols.DATE + " long" +
                ")"
        );
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
